/*!
	\file	SoundSystem.h
	 Header file to manage audiere, a open source sound library 

	\author	Sensibilab E-Mail: info.sensibilab@polimi.it

	\date	2007-09-06 creation \n
		2009-01-27 last modification

	\b COPYRIGHT: 
		This program is property of Sensibilab - Campus Ponit - Lecco
*/

#pragma once

#include "Constants.h"
#include "irrKlang.h"
#pragma comment(lib, "irrKlang.lib")

#include "SoundSystem_base.h"
#include <iostream>

using namespace std;
using namespace irrklang;

/*!\class SoundSystem
Class to manage the sound library. It is base on irrKlang library.*/
class SoundSystem : public SoundSystem_base
{
	ISoundEngine* engine;
	ISoundSource* GenericSound;
	ISound* PlayingSound;
public:
	/*!\fn SoundSystem(void): public SoundSystem_base()
	The constructor method is used to initialize the communication with the sound card.*/
	SoundSystem(void);
	~SoundSystem(void);

	/*!\fn void AddStream(char *FileName, float Volume , float Pan, bool isStreaming, bool isRepeat)
	This function create a new stream to be played
	\param FileName Path of the audio file.
	\param Volume Volume level.
	\param Pan 
	\param isStreaming true = the file isn't loaded but the execution of the file is streamed. false = the audio file is loaded.
	\param isRepeat true=loop false=the file is played only one time.*/
	void AddStream(char *FileName, float Volume , float Pan, bool isStreaming, bool isRepeat);
	ISound* AddStream(char *FileName, float Volume , float Pan, bool isRepeat);

	ISound* Play3DSound(char *FileName, float Volume, bool isStreaming, bool isRepeat, irrklang::vec3df position, bool track, bool SoundEffect);

	void SetListenerPos(vec3df pos, vec3df lookdir, vec3df velPerSec = vec3df(0,0,0), vec3df UpVec=vec3df(0,1,0));
	/*!\fn void PlayMusic()
	This function starts the music play.*/
	void PlayMusic(ISound* Sound);
	void PlayMusic(void);
	/*!\fn void SoundSystem::StopMusic()
	This function stop the execution of the audio file.*/
	void StopMusic(ISound* Sound);
	void StopMusic(void);
	/*!\fn void ResetMusic()
	Reset the music; the execution starts from the beginning.*/
	void ResetMusic(ISound* Sound);
	void ResetMusic(void);
	/*!\fn void SoundSystem::FastPlayFX(char *FileName)
	Play a wav file without creating a stream.*/
	void FastPlayFX(char *FileName,float volume);
};

